//
//  StatusCellBottomView.swift
//  WeChat
//
//  Created by 梁迪 on 15/12/20.
//  Copyright © 2015年 梁迪. All rights reserved.
//

import UIKit
import SnapKit

class StatusCellBottomView: UIView {
    
    
    @objc private func CommentClick(){
        let temp = TempViewController()
        self.navController()?.pushViewController(temp, animated: true)
        
        
        
    }
    
    
    
    

    override init(frame: CGRect) {
        super.init(frame: frame)
        setupUI()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    private func setupUI(){
        addSubview(retweetedBtn)
        addSubview(commentBtn)
        addSubview(likeBtn)
        
      //设置约束
        retweetedBtn.snp_makeConstraints { (make) -> Void in
            make.left.top.bottom.equalTo(self)

        }
        commentBtn.snp_makeConstraints { (make) -> Void in
            make.top.bottom.equalTo(self)
            make.left.equalTo(retweetedBtn.snp_right)
            make.width.equalTo(retweetedBtn.snp_width)
        }
        
        
        likeBtn.snp_makeConstraints { (make) -> Void in
            make.right.equalTo(self.snp_right)
            make.left.equalTo(commentBtn.snp_right)
            make.width.equalTo(commentBtn.snp_width)
            make.top.bottom.equalTo(self)
         
        }
        
        
        let sepView1 = sepView()
        let sepView2 = sepView()
        let w:CGFloat = 0.5
        let scale = 0.4
        
        addSubview(sepView1)
        addSubview(sepView2)
        
        sepView1.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(retweetedBtn.snp_right)
            make.height.equalTo(self.snp_height).multipliedBy(scale)
            make.centerY.equalTo(self.snp_centerY)
            make.width.equalTo(w)
        
            
        }
        sepView2.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(commentBtn.snp_right)
            make.height.equalTo(self.snp_height).multipliedBy(scale)
            make.centerY.equalTo(self.snp_centerY)
            make.width.equalTo(w)
        }
        
        commentBtn.addTarget(self, action: "CommentClick", forControlEvents: .TouchUpInside)
        
    }
    
    
    
    //生成分割线
    private func sepView() -> UIView {
        let v = UIView()
        
        v.backgroundColor = UIColor.darkGrayColor()
        return v
        
        
        
        
        
    }
    
    
    private lazy var retweetedBtn:UIButton = UIButton(title: "转发", backImageName:nil, fontSize: 10, color: UIColor.grayColor(), imageName: "timeline_icon_retweet")
    private lazy var commentBtn:UIButton = UIButton(title: "评论", backImageName:  nil, fontSize: 10, color: UIColor.grayColor(), imageName: "timeline_icon_comment")
    private lazy var likeBtn:UIButton = UIButton(title: "转发", backImageName:  nil, fontSize: 10, color: UIColor.grayColor(), imageName: "timeline_icon_unlike")
    
    

}
